﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using Core.CSV;
using Game.Trade;
using Unity.VisualScripting;

namespace Game {
    public class NPCTradeModule : NPCModule,ISeller {
        private List<ISellable> mBags = new ();

        public ReadOnlyCollection<ISellable> SellList {
            get => mBags.AsReadOnly();
        }

        public int Money {
            get;
            private set;
        }
        
        /// <summary>
        /// param[0]：初始金额
        /// param[1]：默认配置
        /// </summary>
        protected override void onInit(params object[] param) {
            Money = (int)param[0];
            if (param.Length > 1) {
                var config = Tables.TBSeller.GetRow<TBSellerConfig>((uint)param[1]);
                mBags = TradeUtils.TranslateConfigIntoThings(config);
            }
        }

        public void Sell(ISellable thing) {
            
        }
    }
}